package com.mercycrazy.recruit.dao;

import com.mercycrazy.recruit.entity.Admin;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

/**
 * Admin Dao 接口定义
 *
 * @author <a href="mailto:1443424326@qq.com">mercycrazy</a>
 * @since 2023-01-14
 */
public interface AdminDao extends JpaRepository<Admin, String>, JpaSpecificationExecutor<Admin> {

    Optional<Admin> findFirstByUsername(
            String username
    );

    @Transactional
    Integer deleteAdminByUsernameEquals(String username);
}
